 package session.stateless; 
 
import entity.PlainTextMessage;
import java.util.List;
import javax.ejb.Stateless; 
import javax.persistence.EntityManager; 
import javax.persistence.PersistenceContext; 
import javax.persistence.Query; 
 
@Stateless 
public class AnnouncementSession implements AnnouncementSessionLocal  
{ 
    @PersistenceContext 
    private EntityManager entityManager; 
     
     
     
    public List <PlainTextMessage> getAllAnnouncement() 
    { 
        Query query = entityManager.createQuery("SELECT m FROM PlainTextMessage m WHERE m.receiver=:announcement");
        query.setParameter("announcement", "Announcement");
        return query.getResultList(); 
    }
} 